import axios from "axios";
import service from "@/config/index";

export default {
  // 合单
  combined (params) {
    return axios.post(`${service.serviceTransport}/combine`, params);
  },
  // 合单调度
  dispatch (params) {
    return axios.post(`${service.serviceTransport}/combine/dispatch`, params);
  },
  // 获取合单号
  getCombineNo () {
    return axios.get(`${service.serviceTransport}/combine/contract/no`);
  },
  // 获取合单详情
  getCombineDetail (combineId) {
    return axios.get(`${service.serviceTransport}/combine/${combineId}`);
  },
  // 获取合单复制详情
  getCombineCopy (combineId) {
    return axios.get(`${service.serviceTransport}/combine/${combineId}/copy`);
  },
  // 合单修改
  combinedUpdate (params) {
    return axios.put(`${service.serviceTransport}/combine/update`, params);
  },
  // 货物跟踪
  cargoTracking (params) {
    return axios.post(`${service.serviceTransport}/track/search`, params);
  },
  // 接收
  recall (params) {
    return axios.post(`${service.serviceTransport}/combine/accept`, params);
  },
  // 同意关单
  agreeClose (params) {
    return axios.post(
      `${service.serviceTransport}/combine/agree/close`,
      params
    );
  },
  // 拒绝接收
  rejected (params) {
    return axios.post(
      `${service.serviceTransport}/combine/rejected`,
      params
    );
  },
  // 拒绝关单
  rejectedClose (params) {
    return axios.post(
      `${service.serviceTransport}/combine/rejected/close`,
      params
    );
  },
  // 撤销调度
  cancelDispatch (params) {
    return axios.post(
      `${service.serviceTransport}/combine/cancel/dispatch`,
      params
    );
  }
};
